<template>
    <!-- search实时更新 -->
    <input type="text" v-model="search" @change="search">
</template>
<!-- emit -->
<script>
export default {
    data() {
        return {
            search: ''
        }
    },
    // 监听search实时更新
    watch: {
        // 实时发送新数据给父组件
        search(newValue, oldValue) {
            
            this.$emit('search-change', newValue)
        }
    }
}
</script>

<style lang="scss" scoped></style>